package com.clms.rents.controller;

import com.clms.common.R;
import com.clms.rents.pojo.entity.TbBrand;
import com.clms.rents.pojo.entity.TbShop;
import com.clms.rents.pojo.vo.CarBrandVo;
import com.clms.rents.pojo.vo.CarShopVo;
import com.clms.rents.service.CarShopService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-third
 * @description: 车的商店
 * @author: 杨浩
 * @create: 2021-07-22 12:16
 **/
@RestController
@RequestMapping("rents/shop")
public class CarShopController {

    @Resource
    private CarShopService carShopService;

    @GetMapping("selectall")
    public R selectall(){
        return carShopService.selectall();
    }//


    @PostMapping("pageSelect/{currentPage}/{pageSize}")
    public R pageSelect(@PathVariable Integer currentPage,
                        @PathVariable Integer pageSize,
                        @RequestBody CarShopVo carBrandVo){
        return carShopService.pageSelect(currentPage,pageSize,carBrandVo);
    }
    @PostMapping("insert")
    public R insert(@RequestBody TbShop tbShop){
        return carShopService.insert(tbShop);
    }

    @GetMapping("selectById/{id}")
    public R selectByid(@PathVariable Integer id){
        return carShopService.selectById(id);
    }

    @PutMapping("update")
    public R update(@RequestBody TbShop tbShop){
        return carShopService.update(tbShop);
    }
    @DeleteMapping
    public R delete(@RequestParam Integer id){
        return carShopService.delete(id);
    }
}
